#include "app_nm25q128.h"

#include "app_debug_printf.h"
#include "bsp_nm25q128.h"

uint32_t nm25q128_part_addr_base[NM25Q128_PART_NUM] = {0x00000000, 0x00100000,
													   0x00200000, 0x00300000};
uint32_t nm25q128_part_size[NM25Q128_PART_NUM] = {0x00100000, 0x00100000,
												  0x00100000, 0x00d00000};

void nm25q128_test(void)
{
	uint8_t buf[256] = {0};

	nm25q128_erase_sector(0x0);
	for (uint16_t i = 0; i < sizeof(buf); ++i)
	{
		buf[i] = 2;
	}
	nm25q128_read_data(0x0, buf, sizeof(buf));
	debug_printf("after erasing sector->nm25q128_read_data:\r\n");
	for (uint16_t i = 0; i < sizeof(buf); ++i)
	{
		debug_printf("%d ", buf[i]);
	}
	debug_printf("\r\n");

	for (uint16_t i = 0; i < sizeof(buf); ++i)
	{
		buf[i] = i;
	}
	nm25q128_page_program(0x0, buf, sizeof(buf));
	for (uint16_t i = 0; i < sizeof(buf); ++i)
	{
		buf[i] = 2;
	}
	nm25q128_read_data(0x0, buf, sizeof(buf));
	debug_printf("after programing page->nm25q128_read_data:\r\n");
	for (uint16_t i = 0; i < sizeof(buf); ++i)
	{
		debug_printf("%d ", buf[i]);
	}
	debug_printf("\r\n");
}
